﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using QuanLyNhaSach.QuanLyNhaSachDTO;
using QuanLyNhaSach.QuanLyNhaSachDao;

namespace QuanLyNhaSach.QuanLyNhaSachBus
{
    class KhachHangBus
    {
        public static DataTable GetKhachHangAll()
        {
            DataTable dt = KhachHangDao.GetKhachHangAll();
            return dt;
        }
        public static bool Insert(KhachHangDTO kh)
        {
            if (KhachHangDao.Insert(kh))
                return true;
            else
                return false;
        }
        public static void Delete(KhachHangDTO kh)
        {
            KhachHangDao.Delete(kh);
        }
        public static bool Update(KhachHangDTO kh)
        {
            if (KhachHangDao.KTTen(kh.TenKhachHang) == false && KhachHangDao.KTTenTT(kh.TenKhachHang) == false)
            {
                KhachHangDao.Update(kh);
                return true;
            }
            else
                return false;
        }
        public static bool Update1(KhachHangDTO kh)
        {
            if (KhachHangDao.KTTen(kh.TenKhachHang) == false)
            {
                KhachHangDao.Update(kh);
                return true;
            }
            else
                return false;
        }
        ///////////////////Tra cứu///////////////////////////
        public static DataTable KhachHangTraCuuTen(string ten)
        {
            DataTable dt = KhachHangDao.KhachHangTraCuuTen(ten);
            return dt;
        }
        public static DataTable KhachHangTraCuuDiaChi(string diachi)
        {
            DataTable dt = KhachHangDao.KhachHangTraCuuDiaChi(diachi);
            return dt;
        }
        public static DataTable KhachHangTraCuuDienThoai(string dienthoai)
        {
            DataTable dt = KhachHangDao.KhachHangTraCuuDienThoai(dienthoai);
            return dt;
        }
        public static DataTable KhachHangTraCuuEmail(string email)
        {
            DataTable dt = KhachHangDao.KhachHangTraCuuEmail(email);
            return dt;
        }
        public static DataTable KhachHangTraCuuTienNo(string tienno)
        {
            DataTable dt = KhachHangDao.KhachHangTraCuuTienNo(tienno);
            return dt;
        }
    }
}
